<?php
$files=$_FILES['imgfile'];
$files['img']='upload/'.$files['name'];
if(move_uploaded_file($files['tmp_name'],$files['img'])){
    $files['code']=1;
}

echo json_encode($files);